<template>
	<view class="taber" v-if="status==1">
		<view class="taber-item relative" v-for="(item,index) in list" :key="index" @click="onTaber(item.pagePath,index)">
			<uni-icons :type="item.type" size="24" :color="props.count==index?' #FC6703':'#999'   "></uni-icons>
			<!-- <image class="taber-item-image" :src="props.count==index?item.selectedIconPath:item.iconPath" mode="" :class="item.text==''?'mid':''" :style="index==1?'width:42rpx;height:42rpx;':index==2?'width:46rpx;height:42rpx;':''"></image> -->
			<view class="taber-item-text" :class="props.count==index?'act':''">{{item.text}}</view>
			<!-- <view class="line" v-if="index==2&&read.Home>0&&props.count!=2"></view> -->
		</view>
	</view>
</template>
<script setup>
	import {
		onLoad,
		onShow,
		
	} from "@dcloudio/uni-app";
	import {
		onMounted,
		ref,
		defineProps,
		reactive,
		getCurrentInstance
	} from "vue"
	onLoad(() => {
		
	})
	const {
		proxy
	} = getCurrentInstance()
	const props = defineProps(["count"]);
	// console.log(props);
	let status= ref(1)
	let read= ref({
		Home:0,
		pwMe:0
	})
	onShow(() => {
		// getDate()
		// indexList.sort = false
	})
	onMounted(()=>{
		// getDate()
	})
	let list = ref([{
				"pagePath": "/pages/index/index",
				"text": "首页",
				type:'home',
			},
			{
				"pagePath": "/pages/order-list/order-list",
				"text": "订单",
				type:'list',
			},
			{
				"pagePath": "/pages/profile/profile",
				"text": "我的",
				type:'person',
			}
	])
	const onTaber = (path,index) => {
		console.log("----", path);
		// if (status.value == 1) {
			uni.switchTab({
				url: path,
				fail: err => {
					console.log(err);
				},
				success() {
					// getDate()
				}
			})
		// }
		// if(index==2){
		// 	uni.requestSubscribeMessage({
		// 	  tmplIds: ['GtTGragXkX-j_NNy9iYB9s9erYCupy1EXQqRjS_Q3X8'],
		// 	  success (res) { }
		// 	})
		// }
		// if(index==0||index==1){
		// 	uni.requestSubscribeMessage({
		// 	  tmplIds: ['4t2pmM23KA8-GK6IaklbtZpHnLETXltD8SHm9HWqY_c'],
		// 	  success (res) { }
		// 	})
		// }
	}

	const getDate = () => {
		console.log(proxy.$api)
		proxy.$req.requestGET(proxy.$api.MessageInfo.noRead).then(res => {
			read.value.Home=res.data.count
		})
		// proxy.$req.requestGET(proxy.$api.PwCenterInfo.noRead).then(res => {
		// 	read.value.pwMe=res.data.count
		// })
	}
</script>

<style scoped lang="scss">
	.taber {
		width: 100vw;
		height: 130rpx;
		display: flex;
		align-items: center;
		justify-content: space-around;
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 9999;
		background-color: #fff;

		&-item {
			width: 150rpx;
			height: 100%;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			.line{
				width: 18rpx;
				height: 18rpx;
				background: #FC6703;
				border-radius: 50%;
				position: absolute;
				top: 20rpx;
				right: 50rpx;
			}
			&-image {
				width: 45rpx;
				height: 44rpx;
			}

			.mid {
				width: 88rpx;
				height: 88rpx;
			}

			&-text {
				font-size: 20rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #ADADAD;
				line-height: 20rpx;
				margin-top: 10rpx;
			}

			.act {
				color: #FC6703;
			}
		}
	}
</style>